package suporte;

import java.text.SimpleDateFormat;
import java.util.Date;

public class Validacao {
	public static String EXP_REG_EMAIL = "[A-Za-z0-9\\._-]+@[A-Za-z]+\\.[A-Za-z]+";
	
	public static boolean validarAtributoObrigatorio(String atributo){
		if(atributo == null || atributo.length()<=0)
			return false;
		return true;
	}
	
	public static boolean validarTamanhoMinimo(String atributo,int tamanhoMinimo){
		if(atributo == null || atributo.length()<tamanhoMinimo)
			return false;
		return true;
	}
	
	public static boolean validarEmail(String email){
		if(email == null)
			return false;
		String expReg = EXP_REG_EMAIL;
		return email.matches(expReg);  
	}
	
	public static boolean validarSexo(String sexo){
		if(sexo.equalsIgnoreCase("m") || sexo.equalsIgnoreCase("f"))
			return true;
		return false;
	}
	
	public static boolean validarDataIntervalo(Date data,Date inicio,Date fim){
		if(data.compareTo(inicio)>=0)
			if(data.compareTo(fim)<=0)
				return true;
		return false;
	}
}
